#include "headfiles.h"

using namespace std;

int main(int argc, char **argv) {
    if (argc != 2) {
        cout << "Usage: " << argv[0] << " dup_num" << endl;
        return 0;
    }

    int missing_num = atoi(argv[1]);

    fstream fs;
    fs.open("dup_tmp.txt", fstream::out);
    if (!fs.is_open()) {
        cout << "File dup_tmp.txt open error!" << endl;
        return 1;
    }

    for (int i = 0; i < 40000; i++) {
        int val = i;
        if (val != missing_num) {
            fs << val << endl;
        }
    }

    bool ret_code;
    unsigned int num;
    ret_code = findMissingNum("dup_tmp.txt", num);
    if (ret_code == false) {
        cout << "Find duplicate number error!" << endl;
        return 1;
    }

    cout << "Missing num = " << num << endl;

    return 1;

}
